<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>购物车</title>

    <link href="__PUBLIC__/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="__PUBLIC__/basic/css/demo.css">
    <link rel="stylesheet" href="__PUBLIC__/css/index.css">
    <style>
        .btn_shop {
            border: 1px solid #D6D6D6;
            background: #FFFFFF;
            line-height: 25px;
            font-size: 14px;
            color: #787878;
            width: 30px;
            height: 25px;
            text-align: center;
            vertical-align: middle;
            display: inline-block;
            margin-top: -5px;
        }
        .b1{
            line-height: 22px;
        }
        .am-navbar-default .am-navbar-nav {
            border-top: 1px solid #E9E9E9;
            background-color: #FFFFFF;
        }

        .am-navbar-default a {
            color: #777;
        }

        .cheap{
        background: #FFF8D8;line-height: 25px
        }
        .cheap span {
        font-size: 13px;color: #F48F19;
        }
        .title{
        position: absolute;top: 0px;color: #2C2D2F;font-size:13px;height: 40px;line-height: 20px;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;letter-spacing: 0;
        }
        .map{
        color: #787878;font-size: 11px;position: absolute;top: 45px;left: 95px;
        }

        .imfor{
            position: relative;
        }
        .pudc{
            position: relative
        }
        .money{
            font-size: 14px;color: red;position: absolute;top: 70px;left: 90px;
        }
        .del{
            position: absolute;top: 62px;
        }
    </style>
    <style>
        .shopbox{
            position:fixed;bottom:50px;height: 45px;background-color: #FFFFFF;line-height: 45px;
        }
        .select{
            padding: 13px 0 13px 5px;
        }
        .select span{
            font-size: 11px;vertical-align: middle;color: #787878;
        }
        .totol{
            font-size: 11px;color: #787878;margin-left: 5px;
        }
        .totol span{
            font-size: 15px;color: #FF0000;
        }
        .goset{
            background-color: #FFAD01;font-size: 18px;color: #fff;text-align: center;display: inline-block;width: 100%;
        }
    </style>
    <style>
        .am-modal-no-btn .am-modal-dialog{
            border-radius: 10px;
        }
        .am-modal-hd{
            font-size: 18px;
            font-weight: bold;
        }

        .am-modal-bd .modal-content{
            line-height: 20px;
            display: inline-block;
            font-size: 14px;
            letter-spacing: 1px;
        }
        .off-btn{
            display: inline-block;
            font-size: 16px;
            margin: 10px auto;
            border: 1px solid #D8D8D8;
            color: #666666;
            width: 100px;
            height: 30px;
            line-height: 28px;
            margin-right: 20px;
        }
        .on-btn{
            display: inline-block;
            width: 100px;
            font-size: 16px;
            margin: 10px auto;
            border: 1px solid #FFAD01;
            color: #FFFFFF;
            background: #FFAD01;
            height: 30px;
            line-height: 28px;
        }
        .am-checkbox.am-secondary .am-ucheck-checkbox:hover:not(.am-nohover):not(:disabled) + .am-ucheck-icons{
            color: #FFAD01;
            font-size: 18px;
        }
        .am-checkbox .am-icon-checked:before, .am-radio .am-icon-checked:before, .am-checkbox-inline .am-icon-checked:before, .am-radio-inline .am-icon-checked:before, .am-checkbox .am-icon-unchecked:before, .am-radio .am-icon-unchecked:before, .am-checkbox-inline .am-icon-unchecked:before, .am-radio-inline .am-icon-unchecked:before{
            color: #FFAD01;
            font-size: 18px;
        }
        input[type="checkbox"] {
            margin: 5px 5px 0px 5px;
            display: none;
        }
        .checkbox-label:checked + label {
            background: url(__PUBLIC__/new_images/draw.png) no-repeat;
            background-size: 20px;
        }
        .preduct label {
            cursor: pointer;
            padding-left: 20px;
            line-height: 20px;
            margin-top: 3px;
            margin-left: -2px;
            background: url(__PUBLIC__/new_images/circle.png) no-repeat;
            background-size: 20px;
        }
        input[type="radio"] {
            margin: 5px 5px 0px 5px;
            display: none;
        }



         .select label {
            cursor: pointer;
            padding-left: 24px;
            line-height: 20px;
            margin-top: 3px;
            margin-left: 3px;
            background: url(__PUBLIC__/new_images/circle.png) no-repeat;
            background-size: 20px;

        }

        .radio-label:checked + label {
            background: url(__PUBLIC__/new_images/draw.png) no-repeat;
            background-size: 20px;
        }

        .label_checked {
            cursor: pointer;
            padding-left: 24px;
            line-height: 20px;
            margin-top: 3px;
            margin-left: 3px;
            background: url(__PUBLIC__/new_images/draw.png) no-repeat !important;
            background-size: 20px !important;
        }
    </style>
</head>

<body class="bg-default">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            购物车
        </a>
    </h1>
    <div class="am-header-left am-header-nav">

    </div>
</header>

<!--有商品时-->
<div class="am-g">
    <div class="am-u-sm-12 cheap">
        <!--<span>优惠######</span>-->
    </div>
</div>

<form id="cart_info"  action="__URL__/shop2" method="post">
    <empty name="cartList">
        <div class="am-g am-text-center">
            <!--<img src="__PUBLIC__/new_images/order.png" alt="" width="140" style="margin-top: 65px;">-->
            <span style="font-size: 18px;color: #BFBFBF;display: block;margin-top: 30px;letter-spacing: 2px;">购物车空空的~</span>
        </div>
        <else/>
<div class="am-g bg-white">
    <input type="hidden" name="type" value="1">

    <assign name="index" value="1" />
    <volist name="cartList" id="vo">

    <div class="am-u-sm-12 am-padding-vertical-xs imfor"   <if condition="$index++ eq count($cartList) and $index gt 4">id="end"</if> >

        <div class="am-u-sm-1 am-padding-0 preduct">
            <input type="checkbox"  name="cart[{$vo.id}]" value="{$vo.goods_price}"  class="Each checkbox-label">
            <label class="staff" for="cart[{$vo.id}]">&nbsp</label>
        </div>
        <!--<label class="am-u-sm-1  am-checkbox am-warning check am-padding-0" style="color: #000;">-->
            <!--<input type="checkbox" name="cart[{$vo.id}]" class="Each am-checkbox am-secondary" data-am-ucheck />-->
        <!--</label>-->
        <div class="pudc am-u-sm-11 am-padding-0" onclick="jump({$vo.goods_id})">
            <!--<img src="{$vo.goods_id|goods_thum_images=90,90}"  width="80" height="70"/>-->
            <img src="{$vo.original_img}"  width="80" height="80"/>
            <span class="title">{$vo.goods_name}</span>
            <span class="map">{$vo.region_pri} {$vo.region_city}</span>
            <span class="money">￥{$vo.goods_price}</span>
        </div>
        <!--单价隐藏，填入到上面位置-->
        <div class="pices" hidden>{$vo.goods_price}</div>
        <!--商品数量-->
        <div class="num am-fr" data-cart_id="{$vo.id}">
            <span class="reduc btn_shop b1">-</span>
            <input class="btn_shop" name="goods_num[{$vo.id}]" type="text" value="{$vo.goods_num}"/>
            <span class="add btn_shop b1">+</span>
        </div>
        <!--单减商品合计-->
        <div class="totle" hidden>{$vo['goods_price']*$vo['goods_num']}</div>
        <div class="del"  ><i class="am-icon-trash am-icon-sm" style="color: #999;" onclick="deleteCart({$vo.id})"></i></div>
    </div>
    </volist>

</div>
        <div class="am-g shopbox">
            <div class="am-u-sm-3 select" style="padding-left: 10px;">
                <!--<img src="__PUBLIC__/new_images/yes.png" width="24" alt="">-->
                <!--<label class="am-checkbox am-secondary" style="color: #FFAD01">-->
                    <!--<input type="checkbox"  value="" data-am-ucheck id="all">-->
                    <!--全选-->
                <!--</label>-->

                <input type="radio"  name="all" value="" class="radio-label">
                <label class="" for="all" id="all">全选</label>
                <!--<input type="checkbox" id="all" class="" />全选-->
                <!--<span style="margin-left: 0px;display: block;float: left" >-->
                <!--已选 </span>-->
            </div>
            <div class="am-u-sm-5 am-text-right am-padding-left-0"><span class="totol">合计:<span
            >￥<span id="susum" style="overflow: hidden;">0</span></span></span></div>
            <!--   <div class="am-u-sm-4 am-padding-0"><a href="#" class="goset" data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 280, height: 140}">结算</a>
               </div>-->

            <div class="am-u-sm-4 am-padding-0"><a href="#" onclick="confirmForm()" class="goset" >结算(<span id="num">0</span>)</a>
            </div>
        </div>
</empty>
</form>



<!--无商品时-->
<!--<div class="am-g am-text-center">-->
    <!--<img src="__PUBLIC__/new_images/big_shopcart.png" alt="" style="margin-top: 65px;">-->
    <!--<span style="font-size: 18px;color: #BFBFBF;display: block;margin-top: 30px;letter-spacing: 2px;">~去添加点什么吧</span>-->
<!--</div>-->


<include file="Public:bottom_navbar" />

<!--弹出框-->
<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">标题
            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
        </div>
        <div class="am-modal-bd">
            <div class="am-u-sm-12 am-text-left">
                <span class="modal-content">文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字</span>
            </div>
            <div class="am-u-sm-12">
                <a href="#"><span class="off-btn">不在厦门</span></a>
                <a href="#"><span class="on-btn">在厦门</span></a>
            </div>
        </div>
    </div>
</div>
</body>
<script src="__PUBLIC__/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
<script src="__PUBLIC__/js/shopcart.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>
<script>


    $(function () {
        var w = document.body.clientWidth/12*11-110;
         $('.title').css('width',w);
          $('.title').css('left',90);

        $('#end').css('margin-bottom', '38px');

    });


    function deleteCart(id){

        $.ajax({
            type:"GET",
            url:"__APP__/Home/ShopCart/ajaxDelCart?id=" + id,
            error:function (data){
                console.info(data);
//                alert('服务器错误');
                layer.msg('服务器错误');
            },
            success:function(data){
                console.info(data);
//                alert('成功');
                layer.msg('成功');
            }



        })

    }


    function  confirmForm(){

        var flag = 0;
        $("input[name^='cart']").each(function(){
            console.info($(this).is(':checked'));
            if($(this).is(':checked')){
                flag = 1;
            }
        });

        if(flag == 0)
        {
            layer.msg('请选择商品');
            return ;

        }
//        $('#cart_info').submit();
        confirmShop();
    }

    function jump(goods_id){

        window.location.href = '__APP__/Home/Goods/introduction?goods_id=' + goods_id;

    }



    function confirmShop(){

         var formData = new FormData(document.getElementById('cart_info'));

         $.ajax({
             type:"post",
             url:"__URL__/shop2",
             data : formData,
             processData: false,
             contentType: false,
             error:function (data) {
                 console.info(data);
                 layer.msg('服务器繁忙');

             },
             success:function (data) {

                 console.info(data);

                 if(data.status >= 0){

                     window.location.href = 'http://www.jipintc.com/Home/ShopCart/shop3?order_id=' + data.order_id;

                 }

             }
         });


    }
</script>
</html>